package dao.hibernate;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import dao.*;

import model.*;

public class HibernateNewsTypeDao extends HibernateDaoSupport implements NewsTypeDao{
	public NewsType getById(Long id) {
        return (NewsType) getHibernateTemplate().get(NewsType.class, id);
    }

    public void save(NewsType newsType) {
        getHibernateTemplate().saveOrUpdate(newsType);
    }
 
    @SuppressWarnings({"unchecked"})
    public List<NewsType> getAll() {
        return getHibernateTemplate().find("from NewsType");
    }
    
    public void delete(Long id){
    	Object a = getHibernateTemplate().load(NewsType.class, id);
    	this.getHibernateTemplate().delete(a);  
    }
}
